package mogiksaop.qliphoth.common.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.registries.IForgeRegistry;

import mogiksaop.qliphoth.client.lib.LibResources;
import mogiksaop.qliphoth.common.items.ModItems;
import mogiksaop.qliphoth.common.items.block.ItemBlockMod;
import mogiksaop.qliphoth.common.lib.LibBlockNames;
import mogiksaop.qliphoth.common.lib.LibMisc;

@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public final class ModBlocks {
	public static final Block singleNodeCore = new BlockSingleNodeCore();
	public static final Block multiNodeCore = new BlockMultiNodeCore();
	public static final Block optimalStarterDevice = new BlockOptimalStarterDevice();
	public static final Block zefrasteelOre = new BlockZefrasteelOre();
	/*public static final Block flower = new BlockModFlower();
	public static final Block altar = new BlockAltar();
	public static final Block livingrock = new BlockLivingrock();
	public static final Block livingwood = new BlockLivingwood();
	public static final Block specialFlower = new BlockSpecialFlower();
	public static final Block spreader = new BlockSpreader();
	public static final Block pool = new BlockPool();
	public static final Block runeAltar = new BlockRuneAltar();
	public static final Block pylon = new BlockPylon();
	public static final Block pistonRelay = new BlockPistonRelay();
	public static final Block distributor = new BlockDistributor();
	public static final Block manaVoid = new BlockManaVoid();
	public static final Block manaDetector = new BlockManaDetector();
	public static final Block enchanter = new BlockEnchanter();
	public static final Block turntable = new BlockTurntable();
	public static final Block tinyPlanet = new BlockTinyPlanet();*/

	@SubscribeEvent
	public static void registerBlocks(RegistryEvent.Register<Block> evt) {
		IForgeRegistry<Block> r = evt.getRegistry();

		r.register(singleNodeCore);
		r.register(multiNodeCore);
		r.register(optimalStarterDevice);
		r.register(zefrasteelOre);
		/*r.register(flower);
		r.register(altar);
		r.register(livingrock);
		r.register(livingwood);
		r.register(specialFlower);
		r.register(spreader);
		r.register(pool);
		r.register(runeAltar);
		r.register(pylon);
		r.register(pistonRelay);
		r.register(distributor);
		r.register(manaVoid);
		r.register(manaDetector);
		r.register(enchanter);
		r.register(turntable);
		r.register(tinyPlanet);
		r.register(alchemyCatalyst);
		r.register(openCrate);
		r.register(forestEye);*/

	}

	@SubscribeEvent
	public static void registerItemBlocks(RegistryEvent.Register<Item> evt) {
		IForgeRegistry<Item> r = evt.getRegistry();
		
		r.register(new ItemBlockMod(singleNodeCore).setRegistryName(singleNodeCore.getRegistryName()));
		r.register(new ItemBlockMod(multiNodeCore).setRegistryName(multiNodeCore.getRegistryName()));
		r.register(new ItemBlockMod(optimalStarterDevice).setRegistryName(optimalStarterDevice.getRegistryName()));
		r.register(new ItemBlockMod(zefrasteelOre).setRegistryName(zefrasteelOre.getRegistryName()));
		/*r.register(new ItemBlockWithMetadataAndName(flower).setRegistryName(flower.getRegistryName()));
		r.register(new ItemBlockWithMetadataAndName(altar).setRegistryName(altar.getRegistryName()));
		r.register(new ItemBlockWithMetadataAndName(livingrock).setRegistryName(livingrock.getRegistryName()));
		r.register(new ItemBlockWithMetadataAndName(livingwood).setRegistryName(livingwood.getRegistryName()));
		r.register(new ItemBlockSpecialFlower(specialFlower).setRegistryName(specialFlower.getRegistryName()));
		r.register(new ItemBlockWithMetadataAndName(spreader).setRegistryName(spreader.getRegistryName()));
		r.register(new ItemBlockPool(pool).setRegistryName(pool.getRegistryName()));
		r.register(new ItemBlockMod(runeAltar).setRegistryName(runeAltar.getRegistryName()));
		r.register(new ItemBlockWithMetadataAndName(pylon).setRegistryName(pylon.getRegistryName()));
		r.register(new ItemBlockMod(pistonRelay).setRegistryName(pistonRelay.getRegistryName()));
		r.register(new ItemBlockMod(distributor).setRegistryName(distributor.getRegistryName()));
		r.register(new ItemBlockMod(manaVoid).setRegistryName(manaVoid.getRegistryName()));
		r.register(new ItemBlockMod(manaDetector).setRegistryName(manaDetector.getRegistryName()));
		r.register(new ItemBlockMod(enchanter).setRegistryName(enchanter.getRegistryName()));
		r.register(new ItemBlockMod(turntable).setRegistryName(turntable.getRegistryName()));
		r.register(new ItemBlockMod(tinyPlanet).setRegistryName(tinyPlanet.getRegistryName()));
		r.register(new ItemBlockMod(alchemyCatalyst).setRegistryName(alchemyCatalyst.getRegistryName()));
		r.register(new ItemBlockWithMetadataAndName(openCrate).setRegistryName(openCrate.getRegistryName()));
		r.register(new ItemBlockMod(forestEye).setRegistryName(forestEye.getRegistryName()));
		r.register(new ItemBlockStorage(storage).setRegistryName(storage.getRegistryName()));
		r.register(new ItemBlockWithMetadataAndName(forestDrum).setRegistryName(forestDrum.getRegistryName()));
		r.register(new ItemBlockWithMetadataAndName(shinyFlower).setRegistryName(shinyFlower.getRegistryName()));
		r.register(new ItemBlockWithMetadataAndName(platform).setRegistryName(platform.getRegistryName()));
		r.register(new ItemBlockMod(alfPortal).setRegistryName(alfPortal.getRegistryName()));
		r.register(new ItemBlockDreamwood(dreamwood).setRegistryName(dreamwood.getRegistryName()));
		r.register(new ItemBlockMod(conjurationCatalyst).setRegistryName(conjurationCatalyst.getRegistryName()));
		r.register(new ItemBlockMod(bifrost).setRegistryName(bifrost.getRegistryName()));
		r.register(new ItemBlockWithMetadataAndName(floatingFlower).setRegistryName(floatingFlower.getRegistryName()));*/

		initTileEntities();
	}
	

	private static void initTileEntities() {
		
		//registerTile();
		/*registerTile(TileAltar.class, LibBlockNames.ALTAR);
		registerTile(TileSpecialFlower.class, LibBlockNames.SPECIAL_FLOWER);
		registerTile(TileSpreader.class, LibBlockNames.SPREADER);
		registerTile(TilePool.class, LibBlockNames.POOL);
		registerTile(TileRuneAltar.class, LibBlockNames.RUNE_ALTAR);
		registerTile(TilePylon.class, LibBlockNames.PYLON);
		registerTile(TileDistributor.class, LibBlockNames.DISTRIBUTOR);
		registerTile(TileManaVoid.class, LibBlockNames.MANA_VOID);
		registerTile(TileManaDetector.class, LibBlockNames.MANA_DETECTOR);
		registerTile(TileEnchanter.class, LibBlockNames.ENCHANTER);
		registerTile(TileTurntable.class, LibBlockNames.TURNTABLE);
		registerTile(TileTinyPlanet.class, LibBlockNames.TINY_PLANET);
		registerTile(TileOpenCrate.class, LibBlockNames.OPEN_CRATE);
		registerTile(TileCraftCrate.class, LibBlockNames.CRAFT_CRATE);
		registerTile(TileForestEye.class, LibBlockNames.FOREST_EYE);
		registerTile(TilePlatform.class, LibBlockNames.PLATFORM);
		registerTile(TileAlfPortal.class, LibBlockNames.ALF_PORTAL);
		registerTile(TileBifrost.class, LibBlockNames.BIFROST);*/

	}


	private static void registerTile(Class<? extends TileEntity> clazz, String key) {
		GameRegistry.registerTileEntity(clazz, LibResources.PREFIX_MOD + key);
	}

}
